Ext.onReady(function() {
	Ext.BLANK_IMAGE_URL = PATH + '/extjs-4.1.0/resources/themes/images/default/tree/s.gif';
	Ext.tip.QuickTipManager.init();
	var win = Ext.create('Ext.window.Window', {
		title: '登&nbsp;&nbsp;录',
		layout: 'border',
		height: 200,
		width: 300,
		closable: false,
		resizable: false,
		items: [{
				region: 'center',
				xtype: 'form',
				bodyPadding: 5,
				border: false,
				layout: 'anchor',
				defaults: {
					labelAlign: 'right',
					labelWidth: 50,
					anchor: '95%'
	//								,
	//								listeners: {
	//									scope: this,
	//									specialkey: this.onSpecialkey
	//								}
				},
				defaultType: 'textfield',
				standardSubmit:true,
				items: [{
						fieldLabel: '账&nbsp;&nbsp;号',
						name: 'username',
						allowBlank: false
					}, {
						fieldLabel: '密&nbsp;&nbsp;码',
						name: 'password',
						inputType: 'password',
						allowBlank: false
				}]
		}],
		buttons: [{
				text: '登&nbsp;&nbsp;录',
				iconCls: 'login',
				formBind: true,
				handler: function() {
					win.onSubmit();
				}
//							listeners: {
//								scope: win,
//								click: win.onSubmit
//							}
			}, {
				text: '重&nbsp;&nbsp;置',
				iconCls: 'reset',
				handler: function() {
					win.down('form').getForm().reset();
				}
		}],
		onSubmit: function() {
			var me = this;
			var form = me.down('form').getForm();
			if (form.isValid()) {
				form.submit({
					method: 'post',
					url: PATH + '/login',
					success: function(form, action) {
						//PERMISSIONS = action.result.permissions;
						//USER_NAME = action.result.loginUser.userName;
						//me.close();
						window.location.href = PATH + "/index.jsp";
						//Ext.create('Emp.viewport');
					},
					failure: function(form, action) {
//										Emp.commons.Failure.submit(form,
//												action);
						alert(2);
					}
				});
			}
		},

		onSpecialkey: function(numberfield, e) {
			if (e.getKey() == e.ENTER) {
				this.onSubmit();
			}
		}
	}).show();
})